package com.hpdf.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.hpdf.domain.TbDCarinfo;
import com.hpdf.service.DomeService;
import com.hpdf.utils.web.BizController;
import com.hpdf.utils.web.resultbean.BizResult;
@RestController
@RequestMapping("/dome")
public class DomeController extends BizController{

	@Autowired
	private DomeService domeService;
	
	@RequestMapping(value="/test",method=RequestMethod.GET)
	
	public String queryCarinfo(HttpServletRequest request,HttpServletResponse response){
		BizResult<TbDCarinfo> result = new BizResult<TbDCarinfo>();
		TbDCarinfo tbDCarinfo = new TbDCarinfo();
		tbDCarinfo.setCarid(15);
		try {
			result = domeService.queryCarinfo(tbDCarinfo);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return this.returnJson(response, result);
		
	}
	
	@RequestMapping(value="/tinsert",method=RequestMethod.POST)
	public Integer insertInCarinfo(@RequestBody TbDCarinfo carinfo){
		int i = domeService.insertInCarinfo(carinfo);
		return i ;
	}
	
}
